class User {
  final String userId;
  final String userNickName;
  final String email;
  final String password;
  final String sex;
  final String birthday;
  final String regTime;
  final String logTime;
  final String avatarUrl;
  final int status;

  User({
    required this.userId,
    required this.userNickName,
    required this.email,
    required this.password,
    required this.sex,
    required this.birthday,
    required this.regTime,
    required this.logTime,
    required this.avatarUrl,
    required this.status,
  });

  factory User.fromJson(Map<String, dynamic> json) {
    return User(
      userId: json['userId'],
      userNickName: json['userNickName'],
      email: json['email'],
      password: json['password'],
      sex: json['sex'],
      birthday: json['birthday'],
      regTime: json['regTime'],
      logTime: json['logTime'],
      avatarUrl: json['avatarUrl'],
      status: json['status'],
    );
  }

  Map<String, dynamic> toJson() => {
    'userId': userId,
    'userNickName': userNickName,
    'email': email,
    'password': password,
    'sex': sex,
    'birthday': birthday,
    'regTime': regTime,
    'logTime': logTime,
    'avatarUrl': avatarUrl,
    'status': status,
  };

  User copyWith({
    String? userId,
    String? userNickName,
    String? email,
    String? password,
    String? sex,
    String? birthday,
    String? regTime,
    String? logTime,
    String? avatarUrl,
    int? status,
  }) {
    return User(
      userId: userId ?? this.userId,
      userNickName: userNickName ?? this.userNickName,
      email: email ?? this.email,
      password: password ?? this.password,
      sex: sex ?? this.sex,
      birthday: birthday ?? this.birthday,
      regTime: regTime ?? this.regTime,
      logTime: logTime ?? this.logTime,
      avatarUrl: avatarUrl ?? this.avatarUrl,
      status: status ?? this.status,
    );
  }
}
